﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    
    <script src="Scripts/jquery-1.5.1.js" type="text/javascript"></script>
 

        
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
        
        function getElem(id) {
            return typeof id === 'string' ? document.getElementById(id) : id;
        }
        

        function success(position) {

            var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
            var myOptions = {//Google Earth地图的 api设置选项
                zoom: 15,
                center: latlng,
                mapTypeControl: false,
                navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL },
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById("mapcanvas"), myOptions);
            var marker = new google.maps.Marker({
                position: latlng,
                map: map,
                title: "你在这里！"
            });
        }

        if (navigator.geolocation) {//获取本地的地理信息
            navigator.geolocation.getCurrentPosition(success, function (error) {
                alert(error);
            });
        } else {
            alert("您当前使用的浏览器不支持geolocation服务");
        }
    </script>



      
</head>
    <body>
        <div id="mapcanvas" style="width: 500px;height: 400px;">
     
            
        </div>
    </body>
</html>
